//
// Created by Administrator on 2021/11/3.
// May Saint Diana bless you!
//
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <climits>

using namespace std;

class Solution {
public:
    vector<int> t;
    vector<vector<int>> ans;

    void dfs(int cur, vector<int> &nums) {
        // 所有数字都遇到过
        if (cur == nums.size()) {
            ans.push_back(t);
            return;
        }
        // 当前数字加入
        t.push_back(nums[cur]);
        dfs(cur + 1, nums);
        // 当前数字不加入
        t.pop_back();
        dfs(cur + 1, nums);
    }

    vector<vector<int>> subsets(vector<int> &nums) {
        dfs(0, nums);
        return ans;
    }
};

int main() {
    vector<int> nums{2, 3, 4, 5, 6};
    Solution solution;
    vector<vector<int>> ans = solution.subsets(nums);
    for (const auto &row: ans) {
        for (const auto &x: row) {
            cout << x << " ";
        }
        cout << endl;
    }
    return 0;
}
